package com.bmob.lover.ui.fragment.lover

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView
import com.theone.common.ext.getColor
import com.bmob.lover.R
import com.bmob.lover.app.widget.LoadMoreView
import com.bmob.lover.data.model.bean.Lover
import com.bmob.lover.ui.adapter.LoverReviewAdapter
import com.bmob.lover.ui.fragment.base.BaseSwipePagerFragment
import com.bmob.lover.viewmodel.LoverReviewViewModel
import com.theone.mvvm.core.data.enum.LayoutManagerType
import com.theone.mvvm.ext.qmui.addLeftCloseImageBtn

//  ┏┓　　　┏┓
//┏┛┻━━━┛┻┓
//┃　　　　　　　┃
//┃　　　━　　　┃
//┃　┳┛　┗┳　┃
//┃　　　　　　　┃
//┃　　　┻　　　┃
//┃　　　　　　　┃
//┗━┓　　　┏━┛
//    ┃　　　┃                  神兽保佑
//    ┃　　　┃                  永无BUG！
//    ┃　　　┗━━━┓
//    ┃　　　　　　　┣┓
//    ┃　　　　　　　┏┛
//    ┗┓┓┏━┳┓┏┛
//      ┃┫┫　┃┫┫
//      ┗┻┛　┗┻┛
/**
 * @author The one
 * @date 2021-04-22 14:00
 * @describe TODO
 * @email 625805189@qq.com
 * @remark
 */
class LoverReviewFragment :
    BaseSwipePagerFragment<Lover, LoverReviewViewModel>() {

    override fun showTopBar(): Boolean = true

    override fun isStatusBarLightMode(): Boolean = false

    override fun createAdapter(): BaseQuickAdapter<Lover, *> = LoverReviewAdapter()

    override fun isDarkPage(): Boolean  = true

    override fun isLazyLoadData(): Boolean = false

    override fun getLayoutManagerType(): LayoutManagerType = LayoutManagerType.GRID

    override fun getSpanCount(): Int = 3

    override fun getItemSpace(): Int = 2

    override fun initView(root: View) {
        super.initView(root)
        getColor(mActivity, R.color.black).let {
            root.setBackgroundColor(it)
            getTopBar()?.run {
                setBackgroundColor(it)
            }
        }
        addLeftCloseImageBtn(R.drawable.mz_comment_titlebar_ic_close_light)
    }

    override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
        val data = adapter.data as ArrayList<Lover>
        startFragment(Lover2Fragment.newInstance(data,position,getViewModel().page))
    }

    override fun onFetchTransitionConfig(): TransitionConfig = SCALE_TRANSITION_CONFIG

}